<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>[{lang g_webname}] - {lang g_web_adv}</title>
<meta name="keywords" content="{$cfg_site_keywords}" />
<meta name="description" content="{$cfg_site_description}" />
<!--<link rel="stylesheet" type="text/css" href="css/layout.css">-->

<link type="text/css" rel="stylesheet" href="{TPL}css/NewTopFoot.css"  />
<link type="text/css" rel="stylesheet" href="{TPL}css/ShoppingCart.css"/>
<link href="{TPL}css/buy1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-56181022-1', 'auto');
  ga('send', 'pageview');

</script>
{template 'header'}

<!--<link href="{TPL}newedit/css/public.css" rel="stylesheet" type="text/css" />-->
<link href="{TPL}newedit/css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="{TPL}newedit/js/jquery-1.11.1.min.js"></script>
    <script src="js/jquery.js"></script>
    <script src="js/jquery.countdown.min.js"></script>
    <style type="text/css">
        .item {
            width: 100px;
            height: 100px;
        }
        .buy {
            display: none;
        }
		.blink {
			color: #FFF !important;
			background: #FC79CE;
			!important;
		}
    </style>

    <script type="text/javascript">
        $(document).ready(function(){
			$(".btnclick").click(function(){
			   $('.list .item').each(function(i, e){
                $(e).countdown($(e).data('time'), function(event){
                    if(event.type=='update'){
                        $(this).find('.countdown').html(event.strftime('%H:%M:%S'));
                    }else if(event.type=='finish'){ 
                        $(this).find('.countdown').html('{lang js_end}');
                        $(this).find('.buy').show();
                    }
                })
                .on('finish', function(){
                });
            });
			});
		});
    </script>	
	
<script language="javascript" type="text/javascript">   
    $(document).ready(function(){		

        $(".d_daigou").click(function(){
            $(".jiantou").show();
			$("#CrawlUrl").focus();
        });
        $(".jiantou a").click(function(){
            $(this).parents(".jiantou").hide();
            return false;
        });		

		$("#shangchang").click(function(){
            alert ("{lang g_waiting}");
        });
		
		onloadFunction();
	});
	
	
</script>

<script type='text/javascript'>
(function($) {
    $.fn.goTo = function() {
        $('html, body').animate({
            scrollTop: $(this).offset().top + 'px'
        }, 'fast');
        return this; // for chaining...
    }
})(jQuery);

function checkArea(name,status,obj)
{
	document.getElementById('hdArea').value = name;
	insertParam("area", document.getElementById('hdArea').value);
	
    return false;
}

function clickCat(name,obj)
{
	insertParam("cat", name);
}

function clickArea(name,obj)
{
	insertParam("area", name);
}

function insertParam(key, value)
{
    key = encodeURI(key); value = encodeURI(value);

    var kvp = document.location.search.substr(1).split('&');

    var i=kvp.length; var x; while(i--) 
    {
        x = kvp[i].split('=');

        if (x[0]==key)
        {
            x[1] = value;
            kvp[i] = x.join('=');
            break;
        }
    }

    if(i<0) {kvp[kvp.length] = [key,value].join('=');}

    //this will reload the page, it's likely better to store this until finished
    //document.location.search = kvp.join('&'); 
	document.location =  window.location.pathname + '?' + kvp.join('&') + "#areadiv"; 
	
	
}
function clickMasterCategory(name,area)
{
	
	document.getElementById('spincat').style.display = "";
	var anchorItems = $(".buy_02 #sub_cat_dl a");
		anchorItems.each(function(idx, a) {
			var anchorItem = $(a);
			if(anchorItem[0].children[0].children[0].innerHTML == name)
			{
				$(".buy_02>#sub_cat_dl>a>dl.b_bo_hover").removeClass("b_bo_hover");
				//document.getElementById('hdMasterCat').value = name;
				anchorItem[0].children[0].setAttribute("class","b_bo_hover");
			}
			// and the rest of your code
		});
		
	$.get('subItem1.php?hfArea=' + area + '&hfCategory=' + name, function(data) {
			$("#sub_cat").html(data);
			$('.list .item').each(function(i, e){
                $(e).countdown($(e).data('time'), function(event){
                    if(event.type=='update'){
                        $(this).find('.countdown').html(event.strftime('%D %H:%M:%S'));
                    }else if(event.type=='finish'){ 
                        $(this).find('.countdown').html('{lang js_end}');
                        $(this).find('.buy').show();
                    }
                })
                .on('finish', function(){
                });
            });			
		});
		document.getElementById('spincat').style.display = "none";
		
		$('#sub_cat').goTo();
}
function clickCategory(name,typeid,getcat,obj)
{

		document.getElementById('spinmcat').style.display = "";
		var anchorItems = $(".buy_02 a");
		anchorItems.each(function(idx, a) {
			var anchorItem = $(a);
			if(anchorItem[0].children[0].children[0].innerHTML == getcat)
			{
				$(".buy_02>a>dl.b_bo_hover").removeClass("b_bo_hover");
				document.getElementById('hdCat').value = getcat;
				anchorItem[0].children[0].setAttribute("class","b_bo_hover");
			}
			// and the rest of your code
		});
		
		$.get('subItemCategory.php?typeid=' + typeid + '&hfArea=' + name, 
			function(data) {
			$("#sub_cat_dl").html(data);
			$("#sub_cat").html("");	
		});
		document.getElementById('spinmcat').style.display = "none";
		
		$('#sub_cat_dl').goTo();
    return false;
}



</script>

<script type="text/javascript">
  
		function addToCart(cwname,cwprice,cwqty,cwid,msid){
			var productName=cwname;
			var productUrl="cangwei.php?cat=" + document.getElementById('hdCat').value + "&area=" + document.getElementById('hdArea').value;
			var Picture="images/cangwei.png";
			var ShopName="-";
			var ShopHref="-";
			var price=cwprice;
			var productNum="1";
			var productSendPrice="0";
			var productsize=cwqty;
			var isAuction="0";
			var chicun="0";
			var yanse="-";
			var type="1";
			var expressno="";
			var VIPPrice1="-1",VIPPrice2="-1",VIPPrice3="-1";
			var productRemark="{lang m_space}: " + cwname;
			var category = document.getElementById('hdCat').value;
			var area = document.getElementById('hdArea').value;
			var cw_id = cwid;
			var msid = msid;
			$.ajax({
                    type: "POST",
                    url: "/ajax/fast_ajax.php?action=addcangwei",
                    dataType: "json",
                    //contentType: "application/json;utf-8",
        
					data:"adddata="+encodeURIComponent("{\"name\":'" + productName + "',\"href\":'" + productUrl + "',\"picture\":'" + Picture + "',\"thumbnail\":'" + Picture + "',\"chicun\":'" + chicun + "',\"yanse\":'" + yanse + "',\"shopName\":'" + ShopName + "',\"shopHref\":'" + ShopHref + "',\"price\":'" + price + "',\"vipPrice1\":'" + VIPPrice1 + "',\"vipPrice2\":'" + VIPPrice2 + "',\"vipPrice3\":'" + VIPPrice3 + "',\"buyNum\":'" + productNum + "',\"freight\":'" + productSendPrice + "',\"isAuction\":'" + isAuction + "',\"remark\":'" + productRemark  + "',\"type\":'" + type  + "',\"expressno\":'" + expressno + "',\"buytype\":'" + category + "',\"buyarea\":'" + area + "',\"size\":'" + productsize + "',\"cw_id\":'" + cw_id + "',\"msid\":'" + msid + "'}"),

                   timeout: 10000,
				   error: function (){ alert("{lang m_space_eq}") },
				   success: function (data){
					location.href="/shoppingcart.php";
				   }
                });
		
		}
		
		function addToCartRM(cwname,cwprice,cwrmprice,cwcurrrate,cwqty,cwid){
			window.location.href = "buycangwei_desc.php?cwid="+cwid+"#content"; 
		
		}
		
		function addToCartRM_Ori(cwname,cwprice,cwrmprice,cwcurrrate,cwqty,cwid){
			var productName=cwname;
			
			var productUrl="cangwei.php?cat=" + document.getElementById('hdCat').value + "&area=" + document.getElementById('hdArea').value;
			var Picture="images/cangwei.png";
			var ShopName="-";
			var ShopHref="-";
			var price=cwprice;
			var productNum="1";
			var productSendPrice="0";
			var productsize=cwqty;
			var isAuction="0";
			var chicun="0";
			var yanse="-";
			var type="1";
			var expressno="";
			var VIPPrice1="-1",VIPPrice2="-1",VIPPrice3="-1";
			var productRemark="{lang m_space}: " + cwname;
			var category = document.getElementById('hdCat').value;
			var area = document.getElementById('hdArea').value;
			var cw_id = cwid;
			
			var cw_rm_price=cwrmprice;
			var cw_curr_rate=cwcurrrate;
			
			$.ajax({
                    type: "POST",
                    url: "/ajax/fast_ajax.php?action=addcangwei",
                    dataType: "json",
                    //contentType: "application/json;utf-8",
        
					data:"adddata="+encodeURIComponent("{\"name\":'" + productName + "',\"href\":'" + productUrl + "',\"picture\":'" + Picture + "',\"thumbnail\":'" + Picture + "',\"chicun\":'" + chicun + "',\"yanse\":'" + yanse + "',\"shopName\":'" + ShopName + "',\"shopHref\":'" + ShopHref + "',\"price\":'" + price + "',\"vipPrice1\":'" + VIPPrice1 + "',\"vipPrice2\":'" + VIPPrice2 + "',\"vipPrice3\":'" + VIPPrice3 + "',\"buyNum\":'" + productNum + "',\"freight\":'" + productSendPrice + "',\"isAuction\":'" + isAuction + "',\"remark\":'" + productRemark  + "',\"type\":'" + type  + "',\"expressno\":'" + expressno + "',\"buytype\":'" + category + "',\"buyarea\":'" + area + "',\"size\":'" + productsize + "',\"cw_id\":'" + cw_id + "',\"cw_rm_price\":'" + cw_rm_price + "',\"cw_curr_rate\":'" + cw_curr_rate + "'}"),

                   timeout: 10000,
				   error: function (){ alert("{lang m_space_eq}") },
				   success: function (data){
					location.href="/shoppingcart.php";
				   }
                });
		
		}
		
		$(document).ready(function () {

			//call the blink function on the element you want to blink
			blink(".myDiv", -1, 300); //blink a div with the ID of myDiv
		});

		/**
		 * Purpose: blink a page element
		 * Preconditions: the element you want to apply the blink to, the number of times to blink the element (or -1 for infinite times), the speed of the blink
		 **/
		function blink(elem, times, speed) {
			if (times > 0 || times < 0) {
				if ($(elem).hasClass("blink")) 
					$(elem).removeClass("blink");
				else
					$(elem).addClass("blink");
			}

			clearTimeout(function () {
				blink(elem, times, speed);
			});

			if (times > 0 || times < 0) {
				setTimeout(function () {
					blink(elem, times, speed);
				}, speed);
				times -= .5;
			}
		}
    </script>
	
<!--banner-->
<form method="POST" >
<body>
<div class="box">
	<div class="box_998_cent m_t_20">
	<div class="buy_cont">
    	<div class="b_c_tit">
			
			<li>{lang m_area}:</li>
        	<ul id="divAreaClass">
				<?php $status = 'A'; $areaint = 1; while($areadata = mysql_fetch_array($areadatasql)){ if($areadata['area_name'] == $_GET['area']){ $status = $areadata['area_status']; }?>
					<li><a id="areali<?php echo $areaint; ?>" href="#" onclick='return checkArea("<?php echo $areadata['area_name']; ?>","<?php echo $areadata['area_status']; ?>",this)'><?php echo $areadata['area_name']; ?></a></li>
				<?php $areaint++;} ?>
				<input type="hidden" value="" name="hdArea" id="hdArea">
				<input type="hidden" value="" name="hdpage" id="hdpage">
            </ul>
        </div>
		<?php if($status == 'I'){ 
		$mupdate = mysql_query("update dg_sysconfig set value = value + 1 
		where (varname = 'dianjitaiguocishu' or varname = 'dianjiyinnicishu') 
		and info like '%".$_GET['area']."%'");?> 
	
		<div class="buy_03_tit" style="text-align:center;font-size:20px">{lang g_waiting}</div>
		<!--<div class="buy_03_tit" style="text-align:center;font-size:28px;color:purple">{lang m_comingsoon}</div>--><?php }else{ ?>
		<div class="buy_03_tit"><i>1</i>{lang m_choose_ship_ty}</div>
       <div class="buy_02" id= "areadiv">
			<?php	$typeint = 1; while($typedata = mysql_fetch_array($typedatasql)){ ?>
			<a><dl id="catdl<?php echo $typeint; ?>" onclick="clickCategory('<?php echo $_GET['area'] ?>','<?php echo $typedata['tid'] ?>','<?php echo $typedata['type_name'] ?>',this)"><dt><?php echo $typedata['type_name']; ?></dt><dd><?php echo $typedata['type_desc']; ?></dd></dl></a>
			<?php $typeint++;} ?>
        	
        	
			<input type="hidden" value="" name="hdCat" id="hdCat">
            <div class="clear"></div>
        </div>
		<div class="buy_03_tit buy_04"><i>2</i>{lang m_choose_type}</div>
       <div class="buy_02" >
			<!-- loading -->
				<div class="spinner" id="spinmcat" style="display:none">
				  <div class="spinner-container container1">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				  </div>
				  <div class="spinner-container container2">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				  </div>
				  <div class="spinner-container container3">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				  </div>
				</div>
				<!-- end loading -->
        	<div id="sub_cat_dl"  name="sub_cat_dl">     
				
            </div>
        	
        </div>
		<div class="clear"></div>
		<div class="buy_03_tit buy_04"><i>3</i>{lang m_choose_space}</div>
       
			<!-- loading -->
				<div class="spinner" id="spincat" style="display:none">
				  <div class="spinner-container container1">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				  </div>
				  <div class="spinner-container container2">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				  </div>
				  <div class="spinner-container container3">
					<div class="circle1"></div>
					<div class="circle2"></div>
					<div class="circle3"></div>
					<div class="circle4"></div>
				  </div>
				</div>
				<!-- end loading -->
			<div id="sub_cat" style="margin-left:20px" name="sub_cat">
															
            </div>
		<?php } ?>
		<div class="clear"></div>
        <!--<div class="but_next"><input type="button" class="next_01" value="下一步" /></div>-->
		</div>
    </div>
</div>
<script type="text/javascript" charset="utf-8">
function onloadFunction() {
	var getcat = decodeURIComponent(getUrlParameter('cat'));
	var getarea = decodeURIComponent(getUrlParameter('area'));
	var getpage = getUrlParameter('page');
	
	document.getElementById('hdpage').value = getpage;
	
	if (getarea == "")
	{
		//window.location.href = document.URL + '?cat=普通空运&area=西马'; 
	}
	else
	{
		var listItems = $("#divAreaClass li");
		listItems.each(function(idx, li) {
			var product = $(li);
			if(product[0].children[0].innerHTML == getarea)
			{
				$("#divAreaClass>li>a.b_c_tit_hover").removeClass("b_c_tit_hover");
				document.getElementById('hdArea').value = getarea;
				product[0].children[0].setAttribute("class","b_c_tit_hover");
			}	
			// and the rest of your code
		});
		
		
		
		
		/**/
	}
	
}

function getUrlParameter(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];
        }
    }
	return "";
}  

</script>
</body>
</form>


<div class="clear"></div>
<!--end box-->

<script type="text/javascript" src="{TPL}js/indexSlide.js"></script>
</div>
</body>

{template 'footer'}
</html>
